﻿<UserControl x:Class="TestSocket.AcceptedSockets"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid Background="Black">
        <Grid.RowDefinitions>
            <RowDefinition Height="40"></RowDefinition>
            <RowDefinition Height="2*"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid Grid.Row="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="250" />
                <ColumnDefinition Width="250" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <TextBlock Grid.Column="0" FontSize="25" HorizontalAlignment="Center">Local Addr</TextBlock>
            <TextBlock Grid.Column="1" FontSize="25" HorizontalAlignment="Center">Remote Addr</TextBlock>
            <TextBlock Grid.Column="2" Grid.ColumnSpan="2"  FontSize="25" HorizontalAlignment="Center">Actions on Socket</TextBlock>
        </Grid>
        <ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
        <ItemsControl Name="SocketList" HorizontalAlignment="Stretch">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="250" />
                            <ColumnDefinition Width="250" />
                            <ColumnDefinition Width="*" />                            
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <TextBlock FontSize="20" Text="{Binding SrcAddress}" HorizontalAlignment="Center" VerticalAlignment="Center"  Grid.Column="0"/>
                        <TextBlock FontSize="20" Text="{Binding DestAddress}" HorizontalAlignment="Center" VerticalAlignment="Center"  Grid.Column="1"/>
                        <Button Height="auto"  FontSize="15" Visibility="{Binding CanSendMsg}"  Grid.Column="2" Content="Send Msg"  Tag="{Binding myself}" Click="OnSendMsg" />
                        <ProgressBar Margin="2" Visibility="{Binding CanSendFile}" Minimum="0.0" Maximum="100.0"   Value="{Binding Progress}"  Grid.Column="2"></ProgressBar>
                        <Button  FontSize="15"  Grid.Column="3" Content="Disconnect"  Tag="{Binding myself}" Click="OnDisconnect" />
                    </Grid>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
        </ScrollViewer>
        <TextBox Margin="10"  Name="tbMsg"  Grid.Row="2" FontSize="25" TextWrapping="Wrap" AcceptsReturn="True"/>
    </Grid>
</UserControl>
